package com.hp.demo.controller;

import com.hp.demo.bean.DataContext;
import com.hp.demo.bean.Product_category;
import com.hp.demo.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Scope("prototype")
@RestController
@Slf4j
@RequestMapping("order")
public class OrderController {
    @Resource
    private OrderService orderService;
    @RequestMapping("/getOrder")
    @ResponseBody
    public DataContext getOrder(){
        DataContext dataContext = new DataContext();
        List<Product_category> order = orderService.getOrder();
        if (order != null) {
            dataContext.setCode(200);
            dataContext.setMsg("查询成功");
            dataContext.setData(order);
        }
        return dataContext;
    }



}
